<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function *gen(arg) {
            console.log(arg)
            let one = yield 1
            console.log(one)
            let two = yield 2
            console.log(two)
            let three = yield 3
            console.log(three)
        }
        let it = gen('A')
        console.log(it.next())
        //调用next时可传入参数，该参数会作为上一个yield的返回值
        console.log(it.next('B'))
        console.log(it.next('CC'))
        console.log(it.next('DDD'))
    </script>
</body>
</html>